import 'package:flutter/material.dart';
import 'package:flutter_blog_manage_study/res/r.dart';
import 'package:flutter_blog_manage_study/res/strings.dart';
import 'package:flutter_blog_manage_study/res/style.dart';
import 'package:lottie/lottie.dart';

/// * 作者: Tao
/// * 日期: 2024/3/20
/// * 时间: 10:44
/// * 描述: 加载dialog
class LoadingDialog extends StatelessWidget {
  final String text;

  const LoadingDialog({super.key, this.text = Strings.loading});

  @override
  Widget build(BuildContext context) {
    return Material(
        type: MaterialType.transparency,

        /// 透明类型
        child: Center(
          child: SizedBox(
            width: 100,
            height: 100,
            child: Container(
              decoration: const ShapeDecoration(
                color: Colors.black45,
                shape: RoundedRectangleBorder(
                  borderRadius: BorderRadius.all(
                    Radius.circular(8.0),
                  ),
                ),
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                children: <Widget>[
                  Center(
                      child: Lottie.asset(R.assetsLottieLoading,
                          width: 60, animate: true)),
                  Text(text, style: TextStyles.style_white_14)
                ],
              ),
            ),
          ),
        ));
  }
}
